package devbureau.fstore.common;

import java.util.ArrayList;
import java.util.List;

public class OrderImpl<T extends OrderLine> implements Order {

    protected Integer customerId = null;
    protected String seller = null;
    protected ArrayList<T> lines = null;
    protected OrderStatus status = OrderStatus.prepare;
    protected CustomerData customer = null;
    public OrderImpl() {
        this.status = OrderStatus.prepare;
    }
    
    public OrderImpl(ArrayList<T> lines,Integer customerId,String seller) {
        this.customerId = customerId;
        this.seller = seller;
        this.lines = lines;
        this.status = OrderStatus.prepare;
    }

    public Integer getCustomerId() {
        return customerId;
    }

    public String getSellerLogin() {
        return seller;
    }

    public List<T> getLines() {
        return lines;
    }


    public void setCustomerId(Integer customerId) {
        this.customerId = customerId;
    }

    public void setLines(List<T> lines) {
        this.lines = new ArrayList<T>(lines);
    }
    
    public void setSeller(String seller) {
        this.seller = seller;
    }

    @Override
    public String toString(){
        StringBuilder sb = new StringBuilder();
        sb.append("OrderImpl[").append(customerId).append(" | ").append( seller ).append("{");
        sb.append(lines).append("}").append("]");
        return sb.toString();
    }

    public OrderStatus getStatus() {
        return status;
    }

    public CustomerData getCustomer() {
       return customer;
    }

    public void getCustomer(CustomerData cust) {
       customer = cust;
    }
}
